﻿using System;
using System.Runtime.Serialization;
using System.Text;
using NCMIS.ObjectModel.MetaData;

namespace NCMIS.ObjectModel
{
    /// <summary>
    /// Represents the content stream for a document (cmisContentStreamType).
    /// </summary>
    [DataContract(Namespace = CmisNs.Cmism)]
    public class ContentStream
    {
        /// <summary>
        /// The id of the content stream.
        /// </summary>
        [IgnoreDataMember]
        public string Id
        {
            get;
            set;
        }

        /// <summary>
        /// The length of the content stream in bytes. If the length is unknown it must not be set.
        /// </summary>
        [DataMember(Name = "length")]
        public uint? Length
        {
            get;
            set;
        }

        /// <summary>
        /// MIME Media Type of the content stream. For the primary content of a document it should
        /// match the value of the property cmis:contentStreamMimeType.
        /// </summary>
        [DataMember(Name = "mimeType")]
        public string MimeType
        {
            get;
            set;
        }

        /// <summary>
        /// Filename of the content stream. For the primary content of a document it should match the
        /// value of the property cmis:contentStreamFileName.
        /// </summary>
        [DataMember(Name = "filename")]
        public string Filename
        {
            get;
            set;
        }

        /// <summary>
        /// The content stream. Must be present even if the content stream has 0 bytes.
        /// </summary>
        [DataMember(Name = "stream")]
        public byte[] Stream
        {
            get;
            set;
        }
    }
}
